﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BoCaiWeb.WebSite.Code;
using BoCaiWeb.Business;
using BoCaiWeb.Model;
using Ajeelee.Core.Utils;
using Ajeelee.Core.Database;
using System.Collections;

namespace BoCaiWeb.WebSite.WebAdmin
{
    public partial class LinkList : AuthPageBase
    {
        Hashtable table = new Hashtable();
        protected IList<Links> linkList = new List<Links>();
        ILinksBusiness linkBll = new LinksBusinessFactory().CreateLinksBusiness();

        PageStructure ps = new PageStructure() { PageSize = 15, CurrPage = 1 };

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                ps.CurrPage = QueryParamInt32("page", 1);
                // 删除
                if (!string.IsNullOrEmpty(QueryParam("d")) && QueryParamInt32("d") > 0)
                {
                    linkBll.Delete(QueryParamInt32("d"));
                    Function.RemoveCacheObject("/cache/linksall/");
                }

                linkList = linkBll.GetAllLinksByPage(table, ps);
                pager1.PageStruct = ps;
            }
            catch (Exception ex)
            {
                Function.WriteErrorLog(ex);
            }
        }
    }
}